﻿Public Class FrmVisionFailPath
    Private path As String = ""
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        FrmMain.FolderBrowserDialog1.ShowDialog()
        path = FrmMain.FolderBrowserDialog1.SelectedPath
        If path = "" Then
            MsgBox("不能为空！")
            path = ""
            GoTo d
        End If
        If path.Length <= 3 Then
            MsgBox("不能直接指定盘符根目录！")
            path = ""
            GoTo d
        End If
        If Microsoft.VisualBasic.Right(path, 1) <> "\" Then
            path += "\"
        End If
        TextBox1.Text = path
d:
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        If path <> "" Then
            Dim ss() As String = path.Split("\")
            If ss(ss.Length - 2) <> "VisionFailed" Then
                MsgBox("请指定VisionFailed文件夹！")
                GoTo d
            Else
                gVisionFailedPath = path
            End If

        Else
            MsgBox("路径不能为空！")
            GoTo d
        End If

        SaveSetting("XCPro", "Settings", "VisionFailedPath", gVisionFailedPath)
        FrmMain.TextBox4.Text = gVisionFailedPath
        Me.Close()
d:
    End Sub

    Private Sub FrmVisionFailPath_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        TextBox1.Text = ""
    End Sub

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        FrmMain.Close()
    End Sub
End Class